package com.kt.ktplayer.controller

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import java.io.File
import java.util.*

@RestController
class HelloController{

    @GetMapping(value= ["/hello"])
    fun hello(): List<Map<String, Any>> {
        val basePath = "E:\\书籍\\Java"
        val filepath = File(basePath)
        val list: Array<File>? = filepath.listFiles()
        val resultMap = ArrayList<Map<String,Any>>()
        list?.forEach {
            var map = HashMap<String,Any>()
            map["name"]=it.name
            map["path"]=it.absolutePath
            resultMap.add(map)
        }
        return resultMap
    }
}

